package org.batatasframework.support.controllers;

import org.batatasframework.support.definition.TableDefinitionBuilder;

public abstract class AbstractClientSearchController extends AbstractSearchController{
	
//	@Override
//	public void afterPropertiesSet() throws Exception {
//		super.afterPropertiesSet();
//		//这里有两种情况，一种是同一个表共享相同的上下文对象的，一种是不能共享，对这个表的查询是特定的上下文
//		try(TableDefinitionBuilder builder = tableDefinitionFactory.buildSearchableContextBuilder(getSchema(), getCatalog(), getTableName())){
////			//TODO 在这中间，可以添加代码级的对查询表的一些字段的定义或指定
////			initContext(builder);
////			
////			searchContext = builder.build();
//		}
//	}
	
	/**
	 * 注意，在调用这个方法的时候，{@link #searchContext}值是null值
	 * @param builder
	 */
	protected void initContext(TableDefinitionBuilder builder) throws Exception{ }
	
	protected String getSchema(){ return null; }
	protected String getCatalog(){ return null; }
	protected String getTableName(){ return null; }

//	@Override
//	protected SearchableHttpRequest createSearchSearchRequest(IOperator operator, 
//			TableDefinition searchableContext,
//			HttpServletRequest servletRequest) throws Exception{
//		return new DefaultSearchableHttpRequest(operator, searchableContext, servletRequest);
//	}

//	@Override
//	protected SearchResponse search(SearchableRequest request, SearchableContext context) throws Exception {
////		return searchManager.search(request, context);
//		return null;
//	}
}
